<template>
    <div class="top-bar" :style="{ 'background': backColor, borderRadius: borderRadius }">
        <div class="back" @click="backHome" v-if="showBack">
            <img src="~@/assets/imgs/information/icon_back.png" v-if="backIconType === 'black'" alt="">
            <img src="~@/assets/imgs/information/white_icon_back.png" v-else alt="">
        </div>
        <p class="title" :style="{ 'color': color, 'padding-right': showBack ? '50px' : '0' }" :class="{left0: !showBack }">{{ title }}</p>
    </div>
</template>
<script>
export default {
    props: {
        title: "",
        backColor: {
            default: '#F5F5F5'
        },
        color: {
            default: '#111'
        },
        showBack: {
            default: true
        },
        backUrl: {
            default: ''
        },
        backIconType: {
            default: 'black'
        },
        borderRadius: {
            default: '0'
        },
        backAuto: false
    },
    data() {
        return {}
    },
    methods: {
        backHome() {
            // let content = '';
            // if (this.title == 'Identity Information') {
            //     content = 'id_page_quit'
            // };
            // if (this.title == 'Work Information') {
            //     content = 'job_page_quit'
            // };
            // if (this.title == 'Contact Information') {
            //     content = 'contact_page_quit'
            // }
            // if (this.title == 'Additional Information') {
            //     content = 'additional_page_quit'
            // }
            // if (this.title == 'Personal Information') {
            //     content = 'basic_page_quit'
            // }
            // if (content != '') {
            //     this.$hybrid.action('ee', {
            //         content: content,
            //         value: '',
            //     });
            // }
            this.$emit('navBack');
            if (this.backAuto) {
                return
            }
            if (this.backUrl == '') {
                this.$router.go(-1)
            } else {
                this.$router.push(this.backUrl)
            }
        },
    }
}
</script>
<style lang="scss">
.top-bar {
    position: relative;
    align-items: center;
    justify-content: flex-start;
    position: fixed;
    top: 0;
    left: 0;
    height: 90px;
    width: 100%;
    background: #ffffff;
    z-index: 2;
    padding: 0 30px;
    border-radius: 0;
    z-index: 9;
    // border-bottom: 1px solid #A4B1FC;

    .back {
        position: relative;
        width: 100px;
        padding: 20px 0;
        z-index: 5;
        img {
            width: 36px;
            height: 36px;
        }
    }

    .title {
        position: absolute;
        left: 50px;
        right: 30px;
        top: 0;
        bottom: 0;
        font-size: 32px;
        color: #222222;
        line-height: 90px;
        font-weight: bold;
        width: 100%;
        text-align: center;
        z-index: 4;
        &.left0 {
            left: 0;
        }
    }

    display: flex;
}
</style>
